<template>
  <div v-if="pageLoading">
    <el-main>
      <el-card shadow="never">
        <el-skeleton :rows="1"></el-skeleton>
      </el-card>
      <el-card shadow="never" style="margin-top: 15px;">
        <el-skeleton></el-skeleton>
      </el-card>
    </el-main>
  </div>
  <work v-if="dashboard && dashboard==='1'" @on-mounted="onMounted"></work>
  <widgets v-else-if="dashboard && dashboard === '0'" @on-mounted="onMounted"></widgets>
</template>

<script>
const {loadModule} = window['vue3-sfc-loader'];
const work = Vue.defineAsyncComponent(() => loadModule('/src/views/home/dashboard/work/index.vue', options));
const widgets = Vue.defineAsyncComponent(() => loadModule('/src/views/home/dashboard/widgets/index.vue', options));

module.exports = {
  name: "dashboard",
  components: {
    work,
    widgets
  },
  data() {
    return {
      pageLoading: true,
      dashboard: null
    }
  },
  created() {
    this.dashboard = this.$TOOL.data.get("APP_USER_INFO").dashboard || '0';
  },
  mounted() {

  },
  methods: {
    onMounted() {
      this.pageLoading = false
    }
  }
}
</script>

<style>
</style>
